<?php

namespace App\model;

use Illuminate\Database\Eloquent\Model;

class Car_adm extends Model
{
    /**
     * 关联到模型的数据表
     */
	protected $table = 'car_adm';

	/**
	*内容:车辆登记
	*作者:*****
	*/
	public function registration()
	{
		return $this
			->join('user','user.use_id', '=', 'car_adm.use_id')
			->join('coach_type','coach_type.coa_id', '=', 'car_adm.c_id')
			->join('car_attendance_type','car_attendance_type.car_id', '=', 'car_adm.car_id')
			->orderBy('c_id','asc')
            ->paginate(4);
	}
	public function regist($search)
	{
		return $this
			->select('c_id','c_num','c_arctic','c_license','coa_coachtype','c_time','c_record','car_type')
			->join('user','user.use_id', '=', 'car_adm.use_id')
			->join('coach_type','coach_type.coa_id', '=', 'car_adm.c_id')
			->join('car_attendance_type','car_attendance_type.car_id', '=', 'car_adm.car_id')
			->where($search)
            ->get();
	}
	public function sitelists()
	{
		return $this->join('site','site.sit_id', '=', 'car_adm.sit_id')->get();
	}

	public function newvehicleadd($arr)
	{
		return $this->insert($arr);
	}

}